package Thread;

public class TickrtDemo01 {

    class TicketTask implements Runnable {
        static int count=10;
        public void run(){
            while(true){
                synchronized (this) {


                    if (count <= 0) break;
                    System.out.println(Thread.currentThread().getName() + count);
                    count--;
                }
            }
        }
    }
    public static void main(String[] args) {
       TicketTask ticket = new TicketTask();
       Thread t1 = new Thread(ticket,"窗口1");
       Thread t2 = new Thread(ticket,"窗口2");
       Thread t3 = new Thread(ticket,"窗口3");
       t1.start();
       t2.start();
       t3.start();


    }
}
